﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ArtsShop.BusinessLogic;

namespace ArtsShop
{
    public partial class ProductsList : System.Web.UI.Page
    {
        int catId = -1; //default category id

        protected void Page_Load(object sender, EventArgs e)
        {
            string catStr = Request.QueryString["CategoryId"];
            
            

            if (catStr!=null)
            {
                Int32.TryParse(catStr, out catId);        
            }
            ListView_Products.DataKeyNames = new string[1] { "ProductID" };
            ListView_Products.DataSource = Product.GetProductsByCat(catId);
            ListView_Products.DataBind();
            ListView_Products.GroupItemCount = 2;

            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "Product", this.ResolveClientUrl("~/scripts/productsListing.js"));
        }

        public void AddToCart_Click(object sender, EventArgs e)
        {

        }
    }
}
